import 'package:dynamic_forms/dynamic_forms.dart';
import 'container.dart';

class ContainerParser extends ElementParser<DyContainer> {
  @override
  String get name => 'container';

  @override
  DyContainer parse(ParserNode parserNode, FormElement parent, parser) {
    var container = DyContainer();
    container.fillContainer(
        id: parserNode.getPlainStringValue('id'),
        parent: parserNode.getParentValue(parent),
        isVisible: parserNode.getIsVisible(),
        children: parserNode.getChildren<FormElement>(
            parent: container,
            childrenPropertyName: DyContainer.childrenPropertyName,
            parser: parser,
            isContentProperty: true));
    return container;
  }
}
